import { useDispatch, useSelector } from "./index";

import React from "react";

const ChildNum = () => {
  const dispatch = useDispatch();
  const num = useSelector((store) => store.num);

  console.log("DEMO3: re-render ChildNum", num);
  return (
    <div className="Child-container">
      <div>num is: {num}</div>
      <button onClick={() => dispatch({ type: "addNum" })}> AddNum </button>
    </div>
  );
};

export default ChildNum;
